#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

command="/usr/sbin/amavisd-snmp-subagent"
pidfile="/run/${RC_SVCNAME}.pid"

# The RELEASE_NOTES say "it is safe to run it as root, although
# perhaps not necessary." I'm not in a position to test, but I bet
# it's safe to run this as amavis:amavis. Since the program itself
# doesn't have the ability to drop privileges, we'd have to let OpenRC
# do that; and in that case, the easiest way to deal with the PID file
# is to let OpenRC handle that, too.
#
# Thus as a means of future-proofing, we run $command in the
# foreground, and let OpenRC background it and write a PID file. So
# if somebody wants to try command_user="amavis:amavis" here, it might
# just work.
command_args="-f"
command_background="true"

depend() {
  use logger
  before amavisd-new snmpd
}
